<extend name="Common:grid"/>
<!-- 
 ------------------------------------------------------
  幻灯列表页面
 ------------------------------------------------------
 -->
<block name="extOptions">
$.extend(defaultJqGridOptions,{
	colModel:[
		{name:"id",index:"id",hidden:true},
		{name:"url",index:"url",width:120,align:"left",sortable:false,editable:true,edittype:"textarea",formoptions:{elmsuffix:"&nbsp;*"}},
		{name:"link",index:"link",width:120,align:"left",sortable:false,editable:true,edittype:"textarea"},
		{name:"title",index:"title",width:100,align:"left",sortable:false,editable:true},
		{name:"show",index:"show",width:50,align:"center",sortable:false,editable:true,edittype:"select",
			formatter:"select",editoptions:{value:"1:是;0:否"},search:true,stype:"select",searchoptions:{value:"-1:不限;1:是;0:否"}},
		{name:"position",index:"position",width:60,align:"center",sortable:true,editable:true,editoptions:{defaultValue:"0"},editrules:{integer:true,minValue:0}},
		{name:"belong",index:"belong",width:80,align:"center",sortable: false,editable:true,formoptions:{elmsuffix:"&nbsp;*"}},
		{name:"view",width:60,align:"center",hidden:false,sortable:false,editable:false,formatter:actionLinksFormatter,
			formatoptions:{
				items:[{
						title:"查看幻灯图片",
						onclick:"viewBanner(this);",
						className:"ui-icon-image"
					}]
				},
			search:false
		}
	],
	sortname:"position"
});
</block>
<block name="afterGrid">
$("#{$layout}_{$Think.ACTION_NAME}_table").jqGrid("filterToolbar").jqGrid('bindKeys');
</block>

<block name="extFunction">
function viewBanner(link){
	var tid=$(link).attr("rowId");
	var table=$("#{$layout}_{$Think.ACTION_NAME}_table");
	table.jqGrid("setSelection",tid);
	var row=table.getRowData(tid);
	var htm="<div style='width:700px;height:400px;text-align:center;'><img src='"+row.url+"' style='max-width:700px;max-height:400px;'/></div>";
	var title=row.title;
	if(isEmpty(title)){
		title="幻灯图片";
	}
	var link=row.link;
	if(!isEmpty(link)){
		htm="<a href='"+link+"' target='_blank'>"+htm+"</a>"
	}
	var dialog=artDialog(htm,title);
}
</block>